<?php
namespace app\user\service\user;

use think\facade\Request;
use app\common\service\BaseService;
use app\common\exception\LogicException;
use app\user\logic\user\Collection as CollectionLogic;

/**
 * 提问接口
 */
class Collection extends BaseService
{

	/**
	 * 添加收藏
	 * Author 亓官雨树<lucky.max@foxmail.com>
	 * Date：   2020-07-22
	 */
	public function addCollection()
	{
		$param = Request::post();
		$data  = app(CollectionLogic::class)->addCollection($param);

		return $this->parseToData($data, 1, '收藏成功');
	}

	/**
	 * 获取收藏列表
	 * Author 亓官雨树<lucky.max@foxmail.com>
	 * Date：   2020-07-22
	 */
	public function getCollectionList()
	{
		$param = Request::get();
		$data  = app(CollectionLogic::class)->getCollectionList($param);

		return $this->parseToData($data, 1, '获取成功');
	}

	/**
	 * 取消收藏
	 * Author 亓官雨树<lucky.max@foxmail.com>
	 * Date：   2020-07-22
	 */
	public function deleteCollection()
	{
		$param = Request::delete();
		app(CollectionLogic::class)->deleteCollection($param);

		return $this->parseToData(['is_delete' => 1], 1, '取消成功');
	}

	/**
	 * 批量取消收藏
	 * Author 亓官雨树<lucky.max@foxmail.com>
	 * Date：   2020-07-22
	 */
	public function deleteCollectionBatch()
	{
		$param = Request::delete();
		app(CollectionLogic::class)->deleteCollectionBatch($param);

		return $this->parseToData(['is_delete' => 1], 1, '取消成功');
	}


}
